package com.xayy.mgt.model;

import cn.kawins.mybatis.base.BaseModel;
import cn.kawins.mybatis.interceptor.FillingCreateTime;
import cn.kawins.mybatis.interceptor.InsertAutoFilling;
import cn.kawins.mybatis.interceptor.UpdateAutoFilling;
import cn.kawins.mybatis.util.SnowflakeId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import lombok.*;

/**
 * 上传文件信息(FileInfo)实体类
 *
 * @author zhangxa
 * @since 2023-08-16 15:14:42
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "health_xw.t_file_info")
@EqualsAndHashCode(callSuper = true)
public class FileInfo extends BaseModel<Long> {
    @Id
    @ApiModelProperty(value = "主键")
    @Column(name = "id")
    @KeySql(genId = SnowflakeId.class)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * 文件名称
     */
    @ApiModelProperty(value = "文件名称")
    @Column(name = "file_name")
    private String fileName;
    /**
     * 文件保存路径
     */
    @ApiModelProperty(value = "文件保存路径")
    @Column(name = "file_path")
    private String filePath;
    /**
     * 文件大小
     */
    @ApiModelProperty(value = "文件大小")
    @Column(name = "file_size")
    private Long fileSize;
    /**
     * 状态（1正常默认，0异常）
     */
    @ApiModelProperty(value = "状态（1正常默认，0异常）")
    @Column(name = "status")
    private String status;
    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    @Column(name = "create_user")
    private Long createUser;

    /**
     * 预览地址
     */
    @ApiModelProperty(value = "预览地址")
    @Column(name = "preview_address")
    private String previewAddress;
    /**
     * 文件名称code
     */
    @ApiModelProperty(value = "文件名称code")
    @Column(name = "name_code")
    private String nameCode;
    /**
     * 文件后缀
     */
    @ApiModelProperty(value = "文件后缀")
    @Column(name = "file_suffix")
    private String fileSuffix;

    /**
     * 创建时间
     */
    @Column(name = "created_time")
    @InsertAutoFilling(value = FillingCreateTime.class)
    @ApiModelProperty(value = "创建时间", accessMode = ApiModelProperty.AccessMode.READ_ONLY, example = "2010-01-01 00:00:00")
    private Date createdTime;
    /**
     * 更新时间
     */
    @Column(name = "updated_time")
    @UpdateAutoFilling(value = FillingCreateTime.class)
    @ApiModelProperty(value = "最后更新时间", accessMode = ApiModelProperty.AccessMode.READ_ONLY, example = "2010-01-01 00:00:00")
    private Date updatedTime;

}

